import request from '@/utils/request'
// 首页表格接口
export const allList = (jobId) => {
	return request({
		url: '/development/v9/jobHeluController/allList',
		method: 'post',
		params: {
			jobId: jobId
		}
	})
}
// 保存接口
export function addfankuiIfon(data) {
	return request({
		url: '/quality/v9/BomFeedbackInfoItem/saveAllItem',
		method: 'post',
		data: data
	})
}

// // 检验项接口
// export const pcpGetList = (jobId) => {
//   return request({
//     url: '/development/v9/jobHeluController/pcpGetList',
//     method: 'post',
//     params: {
//       jobId: jobId
//     }
//   })
// }

// 字典项接口
export const listByCode = (dictCode) => {
	return request({
		url: '/system/v9/dictionary/listByCode',
		method: 'get',
		params: {
			dictCode: dictCode
		}
	})
}

// 查询设备接口
export const TaskTFsceneEax = (jobId) => {
	return request({
		url: '/development/v9/SceneAbnormalFeedback/TaskTFsceneEax',
		method: 'get',
		params: {
			jobId: jobId
		}
	})
}
/////////新反馈接口 //////////////////////

// 查询字典
export const getDictData = (dictCode) => {
	return request({
		url: '/system/v9/dictionary/listByCode?' + 'dictCode=' + dictCode,
		method: 'get',
	})
}

/**
 * 日期格式化
 */
export function dateFormat(date, format) {
	format = format || 'yyyy-MM-dd hh:mm:ss';
	if (date !== 'Invalid Date') {
		let o = {
			"M+": date.getMonth() + 1, //month
			"d+": date.getDate(), //day
			"h+": date.getHours(), //hour
			"m+": date.getMinutes(), //minute
			"s+": date.getSeconds(), //second
			"q+": Math.floor((date.getMonth() + 3) / 3), //quarter
			"S": date.getMilliseconds() //millisecond
		}
		if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
			(date.getFullYear() + "").substr(4 - RegExp.$1.length));
		for (let k in o)
			if (new RegExp("(" + k + ")").test(format))
				format = format.replace(RegExp.$1,
					RegExp.$1.length === 1 ? o[k] :
					("00" + o[k]).substr(("" + o[k]).length));
		return format;
	}
	return '';

}
// 查询原工艺人员
export const getProcessTechniciansInfoList = (data) => {
	return request({
		url: '/quality/v9/processTechniciansInfo/list',
		method: 'post',
		data: data,
	})
}

//获取工艺人员默认值
export const getDefaultTechnical = (data) => {
	return request({
		url: '/quality/v9/FieldFeedbackInfo/getDefaultTechnical',
		method: 'post',
		data: data,
	})
}

// 原工艺人员 保存
export const feedbackInfoProcessUserSave = (data) => {
	return request({
		url: '/quality/v9/FieldFeedbackInfo/feedbackInfoProcessUserSave',
		method: 'post',
		data: data
	})
}

// 发现人员 发现时间
export const getFeedbackInfoById = (id) => {
	return request({
		url: '/quality/v9/FieldFeedbackInfo/findOne',
		method: 'post',
		params: {
			id: id
		}
	})
}

//工艺资源组
export const ResourceGroups = (resourceInfo, standardValues2) => {
	return request({
		url: '/development/v9/MachineShopPlanAPI/queryResourceGroups',
		method: 'get',
		params: {
			resourceInfo: resourceInfo,
			standardValues2: standardValues2
		}
	})
}

// 查询工单信息
export const selectAbnormalProcessList = (param) => {
	return request({
		url: '/quality/v9/abnormalProcess/allData',
		method: 'get',
		params: param
	})
}
// 检验项接口
export const pcpGetList = (jobId) => {
	return request({
		url: '/development/v9/jobHeluController/pcpGetList',
		method: 'post',
		params: {
			jobId: jobId
		}
	})
}

export const getJobBomMsgData = (jobId) => {
	return request({
		url: '/quality/v9/FieldFeedbackInfo/getJobBomMsgData',
		method: 'post',
		params: {
			jobId: jobId
		}
	})
}

// 删除
export const deleteAbnormalProcess = (ids) => {
	return request({
		url: '/quality/v9/abnormalProcess/deleteAbnormalProcess',
		method: 'post',
		data: ids
	})
}
// 修改异常数量
export const saveAbnormalProcess = (data) => {
	return request({
		url: '/quality/v9/abnormalProcess/updateAbnormalProcess',
		method: 'post',
		data: data
	})
}

export const pageByParam = (data) => {
	return request({
		url: '/quality/v9/BomFeedbackInfoItem/data',
		method: 'get',
		params: data
	})
}

export const remove = (id) => {
	return request({
		url: '/quality/v9/BomFeedbackInfoItem/' + id,
		method: 'delete',
	})
}

export const jobPageByParamQaAbnormal = (data) => {
	return request({
		url: '/development/v9/pageScheduling/jobPageByParamQaAbnormal',
		method: 'post',
		data: data
	})
}

export const abnormalEnteringJob = (abnormalProcessList) => {
	return request({
		url: '/quality/v9/abnormalProcess/abnormalEnteringJob',
		method: 'post',
		data: abnormalProcessList,
	})
}

export const pageByParamGetHistoryAbnormalItem = (data) => {
	return request({
		url: '/quality/v9/excelOutPut/pageByParamGetHistoryAbnormalItem',
		method: 'post',
		data: data
	})
}

export const saveMsg = (row) => {
	return request({
		url: '/quality/v9/BomFeedbackInfoItem/saveMsg',
		method: 'post',
		params: row
	})
}

export const pushMes = (taskIds, id, checkIds) => {
	console.log(taskIds, id, checkIds)
	return request({
		url: '/quality/v9/BomFeedbackInfoItem/pushOldMes?taskIds=' + taskIds + '&id=' + id + '&checkIds=' +checkIds,
		method: 'get',
	})
}

export const deleteQualityMes = (data) => {
  return request({
    url: '/quality/v9/abnormalProcess/deleteQualityMes',
    method: 'post',
    data: data
  })
}

export const save = (row) => {
  return request({
    url: '/quality/v9/BomFeedbackInfoItem/save',
    method: 'post',
    params: row
  })
}

export const getInfo = (id) => {
  return request({
    url: '/quality/v9/BomFeedbackInfoItem/'+id,
    method: 'get'
  })
}

export const getPhoto = (dataId,uploader,Authorization) => {
  return request({
    url: '/fileSystem/v9/fileManager/list?dataId='+dataId+'&uploader='+uploader+'&Authorization='+Authorization+'&fileState=0',
    method: 'get'
  })
}


export const deleteFile = (id) => {
  return request({
    url: '/fileSystem/v9/fileManager/remove?ids='+id,
    method: 'delete'
  })
}
